package it.polimi.traveldream.ejb;

import it.polimi.traveldream.ejb.management.HotelDTO;

import java.io.Serializable;

import javax.persistence.*;

import java.util.Date;
import java.util.List;


/**
 * The persistent class for the Hotel database table.
 * 
 */
@Entity
@NamedQueries({
	@NamedQuery(name="Hotel.findAll", query="SELECT h FROM Hotel h"),
	
	@NamedQuery(name="Hotel.filtrati",query="SELECT h FROM Hotel h WHERE h.citta=?1"),
	@NamedQuery(name="Hotel.updateDisp",query="UPDATE Hotel h SET h.postiRimanenti=h.postiRimanenti-1 WHERE h.idHotel=?1"),
	@NamedQuery(name="Hotel.findById", query="SELECT h FROM Hotel h WHERE h.idHotel = ?1"),
	@NamedQuery(name="Hotel.deleteById",query="DELETE FROM Hotel h WHERE h.idHotel=?1")
})

public class Hotel implements Serializable {
	private static final long serialVersionUID = 1L;

	public static final String FIND_ALL = "Hotel.findAll";
	public static final String UPDDISP = "Hotel.updateDisp";
	public static final String FILTR = "Hotel.filtrati";
	public static final String FINDID = "Hotel.findById";
	public static final String DELETE="Hotel.deleteById";

	
	
	@Id
	@GeneratedValue(strategy=GenerationType.IDENTITY)
	private int idHotel;

	@Temporal(TemporalType.DATE)
	private Date data;

	private String nome;

	private int postiRimanenti;

	private int prezzoSingolo;

	
	private String citta;


	public Hotel() {
	}

	public Hotel(HotelDTO hotel) {
		this.citta = hotel.getCitta();
		this.data = hotel.getData();
		this.nome = hotel.getNome();
		this.postiRimanenti = hotel.getPostiRimanenti();
		this.prezzoSingolo = hotel.getPrezzoSingolo();
	}

	public int getIdHotel() {
		return this.idHotel;
	}

	public void setIdHotel(int idHotel) {
		this.idHotel = idHotel;
	}

	public Date getDataPrenotazione() {
		return this.data;
	}

	public void setDataPrenotazione(Date dataPrenotazione) {
		this.data = dataPrenotazione;
	}

	public String getNome() {
		return this.nome;
	}

	public void setNome(String nome) {
		this.nome = nome;
	}

	public int getPostiRimanenti() {
		return this.postiRimanenti;
	}

	public void setPostiRimanenti(int postiRimanenti) {
		this.postiRimanenti = postiRimanenti;
	}

	public int getPrezzoSingolo() {
		return this.prezzoSingolo;
	}

	public void setPrezzoSingolo(int prezzoSingolo) {
		this.prezzoSingolo = prezzoSingolo;
	}

	public String getCitta() {
		return this.citta;
	}

	public void setCitta(String citta) {
		this.citta = citta;
	}


}